// 这块是为了覆盖文档的样式，后期文档整理再删除
.fei-table {
  border-radius: var(--fei-border-radius-large) var(--fei-border-radius-large) 0 0;
  table {
    width: auto;
    border-collapse: separate;
    overflow: auto;
    border: none;
    color: var(--fei-color-text-default);
    font-size: var(--fei-font-size-default);
    border-radius: var(--fei-border-radius-large) var(--fei-border-radius-large) 0 0;
    thead, tbody {
      width: auto;
    }
    thead{
      tr:first-child {
        > *:first-child {
          border-start-start-radius: var(--fei-border-radius-large);
        }
        >*:last-child {
          border-start-end-radius: var(--fei-border-radius-large);
        }
      }
    }
  }
  th, td {
    padding: 0;
    max-width: unset;
    border: none;
  }
  th {
    background-color: var(--fei-color-bg-fa);
  }
}
.fei-table {
  user-select: text;
  color: var(--fei-color-text-default);
  font-size: var(--fei-font-size-default);
  width: inherit;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  background-color: var(--fei-white-color);
  box-sizing: border-box;
  &-wrapper {
    position: relative;
    border-bottom: 0;
    border-right: 0;
    overflow: hidden; // 开启 max-height 时，没有 overflow: hidden，则底部多出 1px，早期没有 overflow 是因为有些控件没有加 transfer
  }
  &-hide {
    opacity: 0;
  }
  &:before {
    content: '';
    display: none;
    width: 100%;
    height: 1px;
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: var(--fei-border-table-color);
    z-index: 1;
  }

  &:after {
    content: '';
    display: none;
    width: 1px;
    height: 100%;
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--fei-border-table-color);
    z-index: 3;
  }
  &-title, &-footer {
    height: 48px;
    line-height: 48px;
    border-bottom: var(--fei-border-table);
  }
  &-footer {
    border-bottom: none;
  }
  &-header {
    overflow: hidden;
  }
  &-overflowX {
    overflow-x: scroll;
  }
  &-overflowY {
    overflow-y: scroll;
  }
  &-tip {
    overflow-x: auto;
    overflow-y: hidden;
  }
  &-with-fixed-top:before {
    display: block;
  }
  &-with-fixed-top&-with-footer {
    .fei-table-footer {
      border-top: var(--fei-border-table);
    }
    tbody tr:last-child td {
      border-bottom: none;
    }
  }
  th, td {
    min-width: 0;
    height: 50px;
    box-sizing: border-box;
    text-align: left;
    text-overflow: ellipsis;
    vertical-align: middle;
    border-bottom: var(--fei-border-table);
  }

  th {
    height: 50px;
    white-space: nowrap;
    overflow: hidden;
    background-color: var(--fei-color-bg-fa);
    color: var(--fei-color-text-primary);
    font-weight: 500;
  }
  td {
    word-break: break-all;
    background-color: #fff;
    transition: background-color var(--fei-animation-duration-base) ease-in-out;
  }
  th&-column, td&-column {
    &-left {
      text-align: left;
    }
    &-center {
      text-align: center;
    }
    &-right {
      text-align: right;
    }
  }
  & table {
    table-layout: fixed;
  }
  &-wrapper-with-border {
    border-radius: var(--fei-border-radius-large) var(--fei-border-radius-large) 0 0;
    .fei-table{
      border-radius: var(--fei-border-radius-large) var(--fei-border-radius-large) 0 0;
    }
    &:before, &:after {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      background-color: var(--fei-border-table-color);
    }
    &:before {
      height: 100%;
      width: 1px;
    }
    &:after {
      height: 1px;
      width: 100%;
    }
  }
  &-border {
    &:before, &:after {
      display: block;
    }
    th, td {
      border-right: var(--fei-border-table);
    }
  }
  &-cell {
    padding: 0 16px;
    box-sizing: border-box;
    color: var(--fei-color-text-default);
    white-space: normal;
    line-height: 24px;

    &-ellipsis {
      word-break: keep-all;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    &-tooltip {
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      &-content {
        word-break: break-all;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 24px;
      }
    }

    &-with-expand {
      height: 47px;
      line-height: 47px;
      padding: 0;
      text-align: center;
    }

    &-expand {
      cursor: pointer;
      transition: transform var(--fei-animation-duration-base) ease-in-out;
      i {
        font-size: var(--fei-font-size-default);
      }
      &-expanded {
        transform: rotate(90deg);
      }
    }
    &-sort {
      cursor: pointer;
      user-select: none;
    }

    // #3159
    &-with-selection {
      .fei-checkbox-wrapper, .fei-checkbox {
        margin: 0;
      }
    }
  }
  &-hidden {
    visibility: hidden;
  }
  th .fei-table-cell {
    display: inline-block;
    word-wrap: normal;
    vertical-align: middle;
  }
  td&-expanded-cell {
    padding: 20px 50px;
  }
  &-stripe &-body, &-stripe &-fixed-body {
    tr:nth-child(2n) {
      td {
        background-color: var(--fei-color-bg-fa);
      }
    }
    // #1380
    tr.fei-table-row-hover {
      td {
        background-color: var(--fei-color-primary-light5);
      }
    }
  }

  tr&-row-hover {
    td {
      background-color: var(--fei-color-primary-light5);
    }
  }

  &-large {
    font-size: var(--fei-font-size-default);
    td {
      height: 55px;
    }
    &-title, &-footer {
      height: 55px;
      line-height: 55px;
    }
    .fei-table-cell-with-expand {
      height: 55px;
      line-height: 55px;
      i {
        font-size: 16px;
      }
    }
  }

  &-small {
    th {
      height: 40px;
    }
    td {
      height: 40px;
    }
    &-title, &-footer {
      height: 40px;
      line-height: 40px;
    }
    .fei-table-cell-with-expand {
      height: 39px;
      line-height: 39px;
    }
  }

  &-row-highlight, tr&-row-highlight&-row-hover, &-stripe &-body tr&-row-highlight:nth-child(2n), &-stripe &-fixed-body tr&-row-highlight:nth-child(2n) {
    td {
      background-color: var(--fei-color-primary-light5);
    }
  }

  &-fixed, &-fixed-right {
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.2);

    &::before {
      content: '';
      width: 100%;
      height: 1px;
      background-color: var(--fei-border-table-color);
      position: absolute;
      left: 0;
      bottom: 0;
      z-index: 4;
    }
  }

  &-fixed-right {
    top: 0;
    left: auto;
    right: 0;
    box-shadow: -2px 0 6px -2px rgba(0, 0, 0, 0.2);
  }
  &-fixed-right-header {
    position: absolute;
    top: -1px;
    right: 0;
    background-color: var(--fei-color-bg-fa);
    border-top: var(--fei-border-table);
    border-bottom: var(--fei-border-table);
  }
  &-fixed-header {
    overflow: hidden;
  }
  &-fixed-body {
    overflow: hidden;
    position: relative;
    z-index: 3;
  }
  &-fixed-shadow {
    width: 1px;
    height: 100%;
    position: absolute;
    top: 0;
    right: 0;
    box-shadow: 1px 0 6px rgba(0, 0, 0, .2);
    overflow: hidden;
    z-index: 1;
  }
  &-sort {
    display: inline-block;
    width: 14px;
    height: 13px;
    margin-top: -1px;
    vertical-align: middle;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    margin-left: 4px;
    i {
      display: block;
      height: 6px;
      line-height: 6px;
      overflow: hidden;
      position: absolute;
      color: var(--fei-color-text-disabled);
      transition: color var(--fei-animation-duration-base) ease-in-out;
      font-size: 12px;
      &:hover {
        color: inherit;
      }
      &.on {
        color: var(--fei-color-primary);
      }
      &:first-child {
        top: 0;
      }
      &:last-child {
        bottom: 0;
      }
    }
  }
  &-tip {
    table {
      width: 100%;
      td {
        text-align: center;
      }
    }
  }
  &-expanded-hidden {
    visibility: hidden;
  }
}

.fei-table-row.fei-table-ghost-class td {
  background: #9eceff;
}

.fei-popper-tooltip-content {
  max-width: 300px;
  line-height: var(--fei-base-line-height);
  word-break: break-all;
}
